home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Memphis Amiga Group
/
MAG Disk (1989-11)(Memphis Amiga Group).zip
/
MAG Disk (1989-11)(Memphis Amiga Group).adf
/
HeadClean
/
disk_support
< prev
next >
Wrap
Text File
|
1986-11-06
|
2KB
|
96 lines
\ Support for Amiga Trackdisk Driver
\
\ Author: Phil Burk
\
\ This file is hereby placed in the Public Domain and may be
\ freely distributed.
getmodule includes
include? UNIT ji:exec/devices.j
include? TD_MOTOR ji:devices/trackdisk.j
include? CreatePort() ju:exec_support
ANEW TASK-DISK_SUPPORT
2 constant NUMHEADS
: DoIO()? ( req -- , report error if bad )
DoIO() ?dup
IF ." Error in DoIO() = " . cr
THEN
;
: TD.MOTOR ( new_state diskreq -- old_state , turn motor on or off )
dup>r
.. iotd_req ..! io_length
TD_MOTOR r@ .. iotd_req ..! io_command
r@ DoIO()?
r> .. iotd_req ..@ io_actual
;
: TD.HC>SECTOR ( head cyl -- sector , calc sector index for cyl)
NUMHEADS * +
NUMSECS *
;
: TD.SHC>OFFSET ( sector head cyl -- byte_offset )
td.hc>sector +
TD_SECTOR *
;
: TD.READ ( rel_buffer #sectors sector# req -- error , read data from disk )
>r
TD_SECTOR * r@ .. iotd_req ..! io_offset
TD_SECTOR * r@ .. iotd_req ..! io_length
>abs r@ .. iotd_req ..! io_data
ETD_READ r@ .. iotd_req ..! io_command
r> DoIO()
;
: TD.READ? ( rel_buffer #sectors sector# req -- , read data from disk )
td.read ?dup
IF ." Error in disk read " = . cr
THEN
;
: TD.FORMAT ( rel_buffer track req -- , format a track )
>r
NUMSECS * TD_SECTOR * r@ .. iotd_req ..! io_offset
NUMSECS TD_SECTOR * r@ .. iotd_req ..! io_length
>abs r@ .. iotd_req ..! io_data
TD_FORMAT r@ .. iotd_req ..! io_command
r> DoIO()?
;
: TD.STATUS ( status_code req -- value )
tuck .. iotd_req ..! io_command
dup DoIO()?
.. iotd_req ..@ io_actual
;
: TD.CHANGENUM ( diskreq -- value , get status and update req )
TD_CHANGENUM over td.status ( -- req val )
dup rot .. iotd_req ..! iotd_count
;
: TD.CREATE ( -- diskport diskreq | 0 , create a trackdisk request )
0 0 createport() ( -- port )
dup
IF dup sizeof() ioextTD createextio() ( -- port req )
dup 0=
IF drop deleteport() 0 ( Couldn't create ext io )
." Couldn't Create Ext IO" cr
THEN
THEN
;
: TD.OPEN ( unit diskreq -- error )
0" trackdisk.device" -rot ( -- name unit req )
0 opendevice()
;
: TD.DELETE ( diskport diskreq -- )
sizeof() ioextTD deleteextio()
deleteport()
;